<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        //父类
        class Phone{
            //构造方法
            constructor(brand, price) {
                this.brand = brand;
                this.price = price;
            }

            //属性方法
            call() {
                console.log('我能够打电话!!!');
            }
        }

        //子类继承
        class SmartPhone extends Phone{
            //构造方法
            constructor(brand, price, color, size) {
                super(brand, price);
                this.color = color;
                this.size = size;
            }
            //属性方法
            Game() {
                console.log('我可以打打游戏!!!');
            }
            Music() {
                console.log('我能够听歌!!!');
            }
            //子类只能对父类进行完全重写，而不能用子类去调父类的重名方法
            call() {
                console.log('我可以视频通话!!!');
            }
        }

        //实例化对象
        const xiaomi = new SmartPhone('小米11Pro', 4399, '黑色', '5.5inch');
        console.log(xiaomi);
        xiaomi.call();
        xiaomi.Game();
        xiaomi.Music();
        xiaomi.call();
    </script>
</body>

</html>